//
//  stack.swift
//  fit
//
//  Created by Archer on 2018/10/19.
//  Copyright © 2018年 Archer. All rights reserved.
//

import Foundation

class Stack<E> {
    private var _storage = [E]()
    
    var count: Int {
        return _storage.count
    }
    
    @discardableResult
    func pop() -> E {
        return _storage.removeLast()
    }
    
    func push(_ e: E) {
        _storage.append(e)
    }
}

extension Stack where E == String {
    func joined() -> String {
        return _storage.joined(separator: "")
    }
}
